//
//  EntertainmentTwoTableViewCell.m
//  WangI
//
//  Created by dllo on 15/11/24.
//  Copyright © 2015年 WJN. All rights reserved.
//

#import "EntertainmentTwoTableViewCell.h"

@implementation EntertainmentTwoTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview:self.titleLabel];
        [_titleLabel release];
        [self addSubview:self.leftImageView];
        [_leftImageView release];
        [self addSubview:self.middleImageView];
        [_middleImageView release];
        [self addSubview:self.rightImageView];
        [_rightImageView release];
        
    }
    return self;
}

- (void)setEntertainmentModel:(EntertainmentModel *)entertainmentModel {
    if (_entertainmentModel != entertainmentModel) {
        [_entertainmentModel release];
        _entertainmentModel = [entertainmentModel retain];
    }
    self.titleLabel.text = entertainmentModel.title;
    [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:_entertainmentModel.imgsrc]];
    [self.middleImageView sd_setImageWithURL:[NSURL URLWithString:[_entertainmentModel.imgextra[0] valueForKey:@"imgsrc"]]];
    [self.rightImageView sd_setImageWithURL:[NSURL URLWithString:[_entertainmentModel.imgextra[1] valueForKey:@"imgsrc"]]];
    
    
    
    
    
}

- (void)layoutSubviews {
    self.titleLabel.frame = CGRectMake(5, 0, self.width, 20);
    NSInteger kWidth = (self.width - 20) / 3;
    self.leftImageView.frame = CGRectMake(5, self.titleLabel.bottom, kWidth, self.height- self.titleLabel.height - 5);
    self.middleImageView.frame = CGRectMake(self.leftImageView.right + 5, self.titleLabel.bottom, kWidth, self.height- self.titleLabel.height - 5);
    self.rightImageView.frame = CGRectMake(self.middleImageView.right + 5, self.titleLabel.bottom, kWidth, self.height- self.titleLabel.height - 5);
    
    
}

- (UIImageView *)leftImageView {
    if (!_leftImageView) {
        self.leftImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _leftImageView;
}

- (UIImageView *)middleImageView {
    if (!_middleImageView) {
        self.middleImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _middleImageView;
}

- (UIImageView *)rightImageView {
    if (!_rightImageView) {
        self.rightImageView = [[UIImageView alloc] initWithFrame:CGRectZero];
    }
    return _rightImageView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    }
    return _titleLabel;
    
}










- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
